package cn.iocoder.yudao.module.system.repository.redis;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

@Component
public class RedisConst {

    /**'
     * key的基础前缀
     */
    public static String BASE_PREFIX;

    public static String UNION = ":";

    @Value("${spring.application.name}")
    public void setBasePrefix(String basePrefix) {
        BASE_PREFIX = basePrefix;
    }

    public static String getKey(String... key) {

        Assert.notEmpty(key, "key不能为空");

        return BASE_PREFIX + StringUtils.join(key, UNION);

    }
}
